package com.openbravo.data.gui;

import com.openbravo.data.user.BrowsableEditableData;
import com.openbravo.data.user.BrowseListener;
import com.openbravo.data.user.StateListener;
import com.openbravo.format.Formats;
import java.awt.Dimension;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class JCounter extends JPanel
  implements BrowseListener, StateListener
{
  private JLabel jLabel2;
  private JLabel jlblCounter;
  private JLabel jlblIndex;

  public JCounter(BrowsableEditableData paramBrowsableEditableData)
  {
    initComponents();
    paramBrowsableEditableData.addBrowseListener(this);
    paramBrowsableEditableData.addStateListener(this);
  }

  public void updateState(int paramInt)
  {
    if (paramInt == 3)
      this.jlblIndex.setText("*");
  }

  public void updateIndex(int paramInt1, int paramInt2)
  {
    if ((paramInt1 >= 0) && (paramInt1 < paramInt2))
      this.jlblIndex.setText(Formats.INT.formatValue(new Integer(paramInt1 + 1)));
    else
      this.jlblIndex.setText("-");
    this.jlblCounter.setText(Formats.INT.formatValue(new Integer(paramInt2)));
  }

  private void initComponents()
  {
    this.jlblIndex = new JLabel();
    this.jLabel2 = new JLabel();
    this.jlblCounter = new JLabel();
    setMaximumSize(new Dimension(80, 20));
    setMinimumSize(new Dimension(80, 20));
    setPreferredSize(new Dimension(80, 20));
    this.jlblIndex.setText("XX");
    add(this.jlblIndex);
    this.jLabel2.setText("/");
    add(this.jLabel2);
    this.jlblCounter.setText("XX");
    add(this.jlblCounter);
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.data.gui.JCounter
 * JD-Core Version:    0.6.0
 */